<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="author" content="李愧愧">
    <title></title>
    <style>
        .box{
            width: 400px;
            height: 400px;
            background-color: bisque;
            margin: 0 auto;
            border: 1px solid bisque;
        }
        .box1{
            width: 342px;
            margin: auto;
            margin-top: 20px;
        }
        .box .box1 span{
            display: inline-block;
            width: 60px;
            height: 20px;
            border: 1px solid black;
            text-align: center;
            background-color: goldenrod;
            border-radius: 5px;
            cursor: pointer;
        }
        .box .box2{
            width: 200px;
            height: 100px;
            background-color: chocolate;
            /* background-color:yellow; */
            margin: auto;
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="box1">
            <span class="span1">变宽</span>
            <span class="span2">变高</span>
            <span class="span3">变色</span>
            <span class="span4">隐藏</span>
            <span class="span5">重置</span>
        </div>
        <div class="box2">

        </div>
    </div>
<script>
    var span1 =document.querySelector('.span1');
    var span2 =document.querySelector('.span2');
    var span3 =document.querySelector('.span3');
    var span4 =document.querySelector('.span4');
    var span5 =document.querySelector('.span5');
    console.dir(span1);
    var box2 =document.querySelector('.box2');
    span1.onclick = function(){
        box2.style.width = '300px';
    }
    span2.onclick = function(){
        box2.style.height = '300px';
    }
    span3.onclick = function(){
        box2.style='background-color:yellow;';
    }
    span4.onclick = function(){
        box2.style.display= 'none';
    }
    span5.onclick =function(){
        box2.style.cssText = '';
    }
</script>
</body>
</html>